import com.atguigu.util.HdfsUtil;
import org.apache.hadoop.fs.FileSystem;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@EnableAutoConfiguration
public class Example {
    private int total = 0;

    @RequestMapping(value = "/hdfs-list")
    public String home() {
        FileSystem fileSystem = HdfsUtil.getFileSystem(HdfsUtil.HDFS_FILE_SYSTEM_HOST);
        HdfsUtil.listFiles(fileSystem, "/origin_data/gmall/log/topic_start/2019-12-25", false);
        total++;
        HdfsUtil.closeStream(fileSystem);
        return "--" + total;
    }

    public static void main(String[] args) {
        SpringApplication.run(Example.class);
    }
}

